home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / FPU / FPU.PAS < prev   
Pascal/Delphi Source File  |  1991-12-22  |  2KB  |  53 lines

  1. function fArctan( ang : single ) : single; assembler;
  2. { ST(1) <- atan( ST(1) / ST); pop( );
  3.   FPATAN computes the artangent in radians of ST(1)/ST.  The mnemonic
  4.   "partial arctangent" is inherited from earlier NDPs, which placed
  5.   restrictions on the values of ST and ST(1).  These values are not
  6.   restricted on the 80387 and 80486. }
  7. asm
  8.    fld ang    { load angle }
  9.    fld1       { load "one" }
  10.    fpatan     { compute "partial" arctangent, actually "full" in 387/486 }
  11. end;
  12.  
  13.  
  14. function fSin( ang : single ) : single; Assembler;
  15. { ST <- sin(ST);             Only 80387 and 80486
  16.   FSIN computes the sine of the top of the stack and stores the result
  17.   in ST.  The value in ST is assumed to be in radians.  The input operand
  18.   to FSIN must be a value such that |ST|<2^63, or no operation takes place
  19.   and the C2 condition code bit is set to 1.  If the operand is a legal
  20.   value, C2 is cleared to 0.  }
  21. asm
  22.    fld ang         { load angle }
  23.    db 0D9h, 0FEh   { FSIN }
  24. end;
  25.  
  26.  
  27. function fCos( ang : single ) : single; Assembler;
  28. { ST <- cos(ST);             Only 80387 and 80486
  29.   FCOS computes the cosine of the value in radians at the top of the stack
  30.   and replaces ST with cosine.  The input operand to FCOS must be a value
  31.   such that |ST|<2^63, or no operation takes place and the C2 condition code
  32.   bit is set to 1.  If the operand is a legal value, C2 is cleared to 0.  }
  33. asm
  34.    fld ang         { load angle }
  35.    db 0D9h, 0FFh   { FCOS }
  36. end;
  37.  
  38.  
  39. function fTan( ang : single ) : single; Assembler;
  40. { ST <- tan(ST); push(1.0);
  41.   FPTAN computes the tangent of the top of the stack and arranges the
  42.   NDP stack such that: ST(1) / ST = tan( original ST ).  The denominator
  43.   is always 1.0 after the FPTAN instruction.  The operand value must be a
  44.   positive number expressed in radians less than PIx2^62, or no operation
  45.   takes place and the C2 condition code bit is set to 1.  If the input
  46.   operand is legal, C2 is cleared to 0. }
  47. var trash : single;
  48. asm
  49.    fld ang         { load angle }
  50.    fptan           { compute tangent }
  51.    fstp trash      { pop denominator, because it's always one }
  52. end;
  53.